<?php

class LoginForm extends BaseForm
{
  public function configure()
  {
    unset($this['_csrf_token']);

    $this->disableLocalCSRFProtection();
    $this->setWidgets(array(
      'username' => new sfWidgetFormInput(),
      'password' => new sfWidgetFormInput(array('type' => 'password')),
    ));

    $this->setValidators(array(
      'username' => new sfValidatorString(),
      'password' => new sfValidatorString(),
    ));

    $this->getValidator('username')->setOption('required' , false);
    $this->getValidator('password')->setOption('required' , false);

    $this->validatorSchema->setPostValidator(new LoginValidatorUser());

    $this->widgetSchema->setNameFormat('login[%s]');
  }
}
